home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-06-19 | 2.0 KB | 77 lines |
- package symantec.itools.awt;
-
-
- /**
- * Creates a text box, containing a list of item, with up and down arrows.
- * Use this component to allow your users to move through a set of fixed
- * values or type a valid value in the box.
- * <p>
- * At run time, only the selected value is displayed in the text box.
- * <p>
- * @see symantec.itools.awt.Spinner
- * @version 1.0, Nov 26, 1996
- * @author Symantec
- */
-
- // 02/15/97 RKM Merged in change to set min and max as in the DES file
-
- public class NumericSpinner
- extends Spinner
- {
- /**
- * Constructs an empty NumericSpinner.
- */
- public NumericSpinner()
- {
- setIncrement(1);
- setMin(0);
- setMax(10);
- }
-
- /**
- * Sets the value to increment/decrement the Spinner by.
- * @param int i the increment/decrement value
- */
- public void setIncrement(int i)
- {
- increment = i;
- }
-
- /**
- * Gets the increment/decrement value.
- * @return the increment/decrement value
- */
- public int getIncrement()
- {
- return increment;
- }
-
- /**
- * Gets the current text from the Spinner.
- * @return the text of the currently selected Spinner value
- */
- protected String getCurrentText()
- {
- return Integer.toString(current);
- }
-
- /**
- * Tells this component that it has been added to a container.
- * This is a standard Java AWT method which gets called by the AWT when
- * this component is added to a container. Typically, it is used to
- * create this component's peer.
- * Here it's used to set maximum text width and note the text of the
- * current selection.
- *
- * @see java.awt.Container#removeNotify
- */
- public void addNotify()
- {
- textWidth = 5; //Math.max(Integer.toString(min).length(), Integer.toString(max).length());
- text = Integer.toString(current);
- super.addNotify();
-
- updateText();
- }
- }
-